(function(){"use strict";BX.namespace("BX.GridTile");BX.GridTile=function(i){if(typeof i==="object"){this.wrapper=i.wrapper;this.inner=i.inner;this.tileList=i.tileList;this.maxTileWidth=i.maxTileWidth||350;this.minTileMultiplier=3;this.maxTitleMultiplier=6;this.tileRatio=i.tileRatio||1.48;this.maxTileHeight=this.maxTileWidth/this.tileRatio;this.counter=0}this.init()};BX.GridTile.prototype.setTileWidth=function(){var i=this.getTileCalculating();var t=this.minTileMultiplier;if(i.width>this.maxTileWidth&&t<this.tileList.length){while(i.width>=this.maxTileWidth&&t<=this.maxTitleMultiplier&&this.minTileMultiplier<this.tileList.length){i=this.getTileCalculating(t++)}}var e=i.width<=this.maxTileWidth?i.width:this.maxTileWidth;var l=i.height<=this.maxTileHeight?i.height:this.maxTileHeight;for(var h=0;h<this.tileList.length;h++){this.tileList[h].style.width=e+"px";this.tileList[h].style.height=l+"px";this.tileList[h].style.marginLeft=i.margin+"px";this.tileList[h].style.marginTop=i.margin+"px"}this.inner.style.marginLeft=-i.margin+"px";this.inner.style.marginTop="-"+i.margin+"px"};BX.GridTile.prototype.getTileCalculating=function(i){var t=this.minTileMultiplier;if(i&&i>this.minTileMultiplier)t=i;var e=this.wrapper.clientWidth;var l=e/10/t*(t-1);var h=Math.floor((e-l)/t);var s=Math.floor(h/this.tileRatio);l=Math.floor(l/(t-1));return{width:h,margin:l,height:s}};BX.GridTile.prototype.init=function(){var i=this;this.setTileWidth();BX.bind(window,"resize",BX.debounce(i.setTileWidth,200,i))}})();